import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
import 'package:pornhub_app/components/community_cell/community_cell.dart';
import 'package:pornhub_app/model/community/community_model.dart';
import 'package:pornhub_app/views/mine/mine_releases/mine_release_community_controller.dart';

import '../../../../components/no_more/no_data.dart';

class MinesReleaseCommunityPage
    extends GetView<MineReleaseCommunityController> {
  final int status; //1-待审核 2-已发布 3-未通过

  const MinesReleaseCommunityPage({super.key, required this.status});

  @override
  Widget build(BuildContext context) {
    return EasyRefresh(
      refreshOnStart: true,
      controller: controller.refreshController,
      onRefresh: () {
        controller.onRefresh(2);
      },
      onLoad: () {
        controller.onLoad();
      },
      child: PagedListView<int, CommunityModel>(
        padding: EdgeInsets.only(top: 10, left: 14.w, right: 14.w),
        addAutomaticKeepAlives: true,
        pagingController: controller.pagingControllers,
        builderDelegate: PagedChildBuilderDelegate<CommunityModel>(
          firstPageProgressIndicatorBuilder: (context) =>
              const SizedBox.shrink(),
          newPageProgressIndicatorBuilder: (context) => const SizedBox.shrink(),
          noMoreItemsIndicatorBuilder: (context) => const SizedBox.shrink(),
          noItemsFoundIndicatorBuilder: (context) => const NoData(),
          itemBuilder: (context, item, index) {
            return CommunityCell(model: item);
          },
        ),
      ),
    );
  }
}
